import { defineStore } from 'pinia'
import { ref } from 'vue'

// 设置 store
export const useSettingStore = defineStore('setting', () => {
  const displayMode = ref<'light' | 'dark'>('light')
  const locale = ref('zh-CN')
  
  const setDisplayMode = (mode: 'light' | 'dark') => {
    displayMode.value = mode
  }
  
  const setLocale = (newLocale: string) => {
    locale.value = newLocale
  }
  
  return {
    displayMode,
    locale,
    setDisplayMode,
    setLocale
  }
}, {
  persist: {
    key: 'setting-store',
    storage: localStorage,
    paths: ['displayMode', 'locale']
  }
})

// 导出所有 store
export * from './form'
export * from './wechat'
export * from './auth'